//功能三个
var gd = document.getElementById("gd");
gd.onclick = showList;
gd.flag = false;
var timesButton = document.querySelector("#bottom_text1 span");
timesButton.onclick = showSelection
timesButton.flag = false;
var ducks = document.getElementsByClassName("ducks")
for (var obj of ducks) {
    obj.onclick = catchDuck;
    obj.flag = false;
}
var slogans=document.querySelectorAll("#slogans>div ")//获得滚动元素
function showList() {
    var list = document.getElementById("title_text1");
    if (this.flag == false) {
        list.style.display = "block";
        this.flag = true;
    }
    else {
        list.style.display = "none";
        this.flag = false;
    }
}

function showSelection() {
    var selection = document.getElementById("bottom_text2");
    var triImg = document.getElementById("sj");
    if (this.flag == false) {
        selection.style.display = "block"
        triImg.style.transform = "rotate(180deg)"
        this.flag = true;
    } else {
        selection.style.display = "none"
        triImg.style.transform = "rotate(0deg)"
        this.flag = false;
    }

}


function catchDuck() {
    if (this.flag == false) {
        this.src = "肥猪1.gif"
        this.classList.add("paopao");
        this.flag = true;
    } else {
        this.src = "bluck/cjyy_yz.png"
        this.classList.remove("paopao");
        this.flag = false;
    }
}

function listRoll(obj){
 
        obj.style.visibility="visible";
        obj.style.right="100%";
        setTimeout(listback,5000,obj);
    }
function listback(obj){
        obj.style.visibility="hidden";
       obj.style.right="-50%"; 
}
window.onload=function(){

setInterval(listRoll,10000,slogans[0]);
setInterval(listRoll,10000,slogans[1]);
}
